﻿using System.Collections.ObjectModel;
using System.ComponentModel.Composition;
using Caliburn.Micro;
using ConditionTreeTestStand.Nodes;
using RatingAuthor;
using SamizdatSearch;

namespace ConditionTreeTestStand
{
  [Export(typeof(IShell))]
  public class MainWindowViewModel : Screen, IShell
  {
    public ObservableCollection<NodeViewModel> Roots { get; private set; }

    [ImportingConstructor]
    public MainWindowViewModel(IWindowManager windowManager)
    {
      var genresLookup = new GenresLookup();
      genresLookup.Lookup(new[] {"Фэнтези", "Фантастика", "Любовный роман", "Детектив", "Документалистика"});
      var nodeContext = new NodeContext(genresLookup, windowManager);
      var startNode = new RootNodeViewModel(nodeContext);
      var root = new GroupNodeViewModel(startNode, nodeContext);
      new ConditionNodeViewModel(root, nodeContext);
      var root1 = new GroupNodeViewModel(root, nodeContext);
      new ConditionNodeViewModel(root1, nodeContext);
      new ConditionNodeViewModel(root1, nodeContext);
      Roots = startNode.Children;
    }
  }
}